@app.route('/')
def home():
- return render_template('index.html')
+ return render_template('index.html', active_button="home")
def query_db(query, args=(), one=False):
cur = g.db.execute(query, args)
@app.route('/votes/<votes>')
def show_votes(votes):
today = date.today()
+ active_button = votes
+ basequery = 'select *, roles.name as rolename from votes join roles on roles.id=votes.id_role'
if votes == 'all':
- votes = query_db('select * from votes order by id desc')
+ votes = query_db(basequery + ' order by id desc')
elif votes == 'archive':
- votes = query_db('select * from votes where date_end < (?) order by id desc', [today])
+ votes = query_db(basequery + ' where date_end < (?) order by id desc', [today])
elif votes == 'current':
- votes = query_db('select * from votes where date_end >= (?) order by id desc', [today])
+ votes = query_db(basequery + ' where date_end >= (?) order by id desc', [today])
else:
abort(404)
- return render_template('show_votes.html', votes=votes)
+ return render_template('show_votes.html', votes=votes, active_button=active_button)
#------
# Vote
<header>
<div class="btn-toolbar">
<div class="btn-group">
- <a class="btn active" href="/">Accueil</a>
- <a class="btn" href="{{ url_for('show_votes', votes='current') }}">Votes en cours</a>
- <a class="btn" href="{{ url_for('show_votes', votes='archive') }}">Archives</a>
+ <a class="btn {% if active_button == 'home' %}active{% endif %}" href="/">Accueil</a>
+ <a class="btn {% if active_button == 'current' %}active{% endif %}" href="{{ url_for('show_votes', votes='current') }}">Votes en cours</a>
+ <a class="btn {% if active_button == 'archive' %}active{% endif %}" href="{{ url_for('show_votes', votes='archive') }}">Archives</a>
{% if session.user and session.user.is_admin %}
<a href="#" class="btn btn-warning dropdown-toggle" data-toggle="dropdown">Admin <b class="caret"></b></a>
<ul class="dropdown-menu pull-right">
</div>
</header>
-<h1 class="page-header">Outil de vote du CA FFDN</h1>
+<h1 class="page-header">Outil de vote du CA FFDN <small>{% block subtitle %}{% endblock %}</small></h1>
{% with messages = get_flashed_messages(with_categories="true") %}
{% if messages %}
{% for category, message in messages %}
{% endif %}
{% endwith %}
+<div class="container">
{% block body %}{% endblock %}
+</div>
</div> <!-- container -->
<script src="{{ url_for('static', filename='js/jquery.js') }}"></script>
{% extends "layout.html" %}
{% block body %}
-<h2>{{ session.username }}</h2>
+<h2>{{ session.user.name }}</h2>
<div class="span8">
<dl>
<dt>Email :
- <dd>{{ session.email }}
+ <dd>{{ session.user.email }}
<dt>Association :
- <dd>{{ session.organization }}
+ <dd>{{ session.user.organization }}
<dt>Groupes :
<dd><em>à venir</em>
</dl>
- <a href="{{ url_for('user_settings', userid=session.userid) }}" class="btn btn-primary">Modifier</a>
+ <a href="{{ url_for('user_settings', userid=session.user.id) }}" class="btn btn-primary">Modifier</a>
</div>
{% endblock %}
{% extends "layout.html" %}
+{% block subtitle %}
+Liste des votes
+{% endblock %}
{% block body %}
- <h2>Liste des votes</h2>
{% for vote in votes %}
<article>
- <div class="well">
- <h3><a href="{{ url_for('show_vote', idvote=vote.id) }}">{{ vote.title }}</a></h3>
- <hr />
- <div class="row">
- <div class="span4">
+ <div class="row well">
+ <div class="span4">
+ <h3><a href="{{ url_for('show_vote', idvote=vote.id) }}">{{ vote.title }}</a></h3>
+ <div class="progress progress-striped">
+ <div class="bar" style="width: 60{{ vote.percent }}%;"></div>
+ </div>
+ </div>
+ <div class="span3">
<h4>Deadline : {{ vote.date_end }} </h4>
- <br />
- <div class="progress progress-striped">
- <div class="bar"
- style="width: {{ vote.pourcent }}%;"></div>
- </div></div>
- <div class="span4">
- <h4>Documents</h4>
+ <h4>Groupe : {{ vote.rolename }}</h4>
+ <h4>Categorie : {{ vote.category }}</h4>
+ </div>
+ <div class="span3">
+ <h4>Notes</h4>
+ <p>
+ {{ vote.description|safe }}
+ </p>
</div>
- <div class="span4">
- <h4>Notes</h4>
- {{ vote.description|safe }}
- </div></div></div>
</article>
{% else %}
<div class="alert">Il n'y a pas encore de votes. Désolé.</div>
<h2>{{ session.username }}</h2>
<div class="row">
<div class="span6 well">
- <form class="form-horizontal" action="{{ url_for('user_settings', userid=session.userid) }}" method="post">
+ <form class="form-horizontal" action="{{ url_for('user_settings', userid=session.user.id) }}" method="post">
<fieldset><legend>Mise à jour du profil utilisateur</legend>
<div class="alert"><strong>Attention :</strong> À l'issue de ce formulaire, vous devrez vous reconnecter</div>
<div class="control-group">
<label class="control-label" for="email">E-mail</label>
<div class="controls">
- <input type="text" name="email" id="email" value="{{ session.email }}"/>
+ <input type="text" name="email" id="email" value="{{ session.user.email }}"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="name">Nom</label>
<div class="controls">
- <input type="text" name="name" id="name" value="{{ session.username }}" />
+ <input type="text" name="name" id="name" value="{{ session.user.name }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="organization">Association</label>
<div class="controls">
- <input type="text" name="organization" id="organization" value="{{ session.organization }}"/>
+ <input type="text" name="organization" id="organization" value="{{ session.user.organization }}"/>
</div>
</div>
<!--<label for="password">Mot de passe</label>
</div>
<div class="span5 well">
- <form class="form-horizontal" action="{{ url_for('user_password', userid=session.userid) }}" method="post">
+ <form class="form-horizontal" action="{{ url_for('user_password', userid=session.user.id) }}" method="post">
<fieldset><legend>Modification du mot de passe</legend>
<div class="control-group">
<label class="control-label" for="password">Mot de passe</label>
<dl class="dl-horizontal">
<dt>Publié par <dd><code>maethor</code>
<dt>Début le <dd><code>{{ vote.date_begin }}</code>
- <dt>Fin le <dd><code>{{ vote.date_end }}</code>
+ <dt>Deadline le <dd><code>{{ vote.date_end }}</code>
<dt>Groupe <dd><code>{{ vote.rolename }}</code>
<dt>Catégorie <dd><code>{{ vote.category }}</code>
</dl>